Building the Model: Advanced Elements > Streams > Stream Example

Stream Example

The following example shows one reason why multiple streams are useful.

 

Two analyzers, Analyzer_1 and Analyzer_2, are to go down approximately every 4 hours for servicing. To model this, the frequency or time between servicing is defined by a normal distribution with a mean value of 240 minutes and a standard deviation of 15 minutes, N(240,15). (For more information on distributions, see User Defined Distributions). The analyzers will go down for 10 minutes. Because no stream is specified in the normal distribution, MedModel uses stream number one to generate sample values for both analyzers. So if the next two numbers in stream number one result in sample values of 218.37 and 264.69, Analyzer_1 will receive 218.37 and Analyzer_2 will receive 264.69. Therefore, the two analyzers will go down at different times, Analyzer_1 after almost four hours and Analyzer_2 after somewhat more than four hours.

 

Suppose, however, that the resource that services the analyzers must service them both at the same time. The analyzers would have to go down at the same time. Stream number one will not bring them down at the same time, because stream number one sends the analyzer’s distributions two different numbers. Using two streams (in the example below numbered ten and eleven) with the same initial seed will ensure that the analyzers receive the same random number every time. The two streams have the same starting seed value so they will produce exactly the same sequence of random numbers. The first number of stream ten will be exactly the same as the first number of stream eleven; the second numbers will be the same; indeed, every number will be the same.

 

The Streams window below shows streams ten and eleven with the same seed values.

By assigning stream ten to Analyzer_1 and eleven to Analyzer_2, both analyzers will go down at exactly the same time.

This first clock downtime for each analyzer will occur at the beginning of the simulation. After that, the first downtime occurs at 218.37 minutes for both analyzers. Defining different seed values for the streams would produce different sequences and therefore different downtimes. Using the same stream number for the clock downtimes would also produce different values. But two different streams with the same seed value will bring both analyzers down at the same time.

 

Note that if a third analyzer were to use one of the streams, for example if Analyzer_3 were to use stream eleven, then the two analyzers would no longer go down together. Analyzer_1 would use the first value from stream ten; Analyzer_2 would use the first value from stream eleven; and Analyzer_3 would use the second value from stream eleven. The first time Analyzer_1 and Analyzer_2 went down, they would go down at the same time because the first number in streams ten and eleven is the same. But thereafter they would not. The second time they would go down at different times because Analyzer_1 would receive the second value from stream ten, Analyzer_2 would receive the third value from stream eleven, and Analyzer_3 would receive the fourth value from stream eleven.

Stream Notes: 1. If a stream value is not specified for a distribution, the stream is assumed to be stream one. Stream #1 does not automatically reset after each replication. 2. The stream parameter is always the last parameter specified in a distribution unless a location parameter is also specified. See Distribution Functions for details.


© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com